home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / artFluidAttrVerifyGrid.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  3.3 KB  |  108 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. // Alias|Wavefront Script File
  19. // MODIFY THIS AT YOUR OWN RISK
  20. //
  21. // Creation Date:  May 2000 
  22. //
  23. //
  24. //
  25. //  Procedure Name:
  26. //         artFluidAttrVerifyGrid
  27. //
  28. //  Description:
  29. //        You can't paint a fluid property unless that
  30. //        property is simulated using either a DynamicGrid
  31. //        or a StaticGrid.  If the user tries to paint a non-
  32. //        grid property, pop up a confirm box
  33. //        
  34. //        This script is tied to the paintFluids tool via:
  35. //
  36. //        artFluidAttrCtx -e -beforeStrokeCmd "artFluidAttrVerifyAttributeGrid"
  37. //        
  38. //        in artFluidAttrToolScript.mel, which creates the tool.
  39. //        
  40. //  Return Value:
  41. //      None.
  42. //
  43. global proc artFluidAttrVerifyGrid( string $current) {
  44.     string $create[];
  45.  
  46.     if( !`exists activeFluidsVerifyGrid` ) {
  47.         source "fluidsVerifyGrid.mel";
  48.     }
  49.  
  50.     if( `activeFluidsVerifyGrid $current $create` ) {
  51.         return;
  52.     }
  53.  
  54.     string $createDynamic = $create[0];
  55.     string $createStatic = $create[1];
  56.  
  57.     // User is trying to paint an attribute that is NOT a grid-valued
  58.     // attribute.  Pop up confirm box and give him the option to
  59.     // change it...
  60.     //
  61.     string $gridTypes;
  62.     string $buttons;
  63.  
  64.     // Only need "Yes" button, since there's no choice for
  65.     // Static grids on these attributes...
  66.     //
  67.     if( size( $createStatic ) == 0 ) {
  68.         $gridTypes = "Dynamic ";
  69.         $buttons = ( "-button \"Set to Dynamic\" " +
  70.                      "-button \"Cancel\" " +
  71.                      "-cancelButton \"Cancel\" " +
  72.                      "-defaultButton \"Set to Dynamic\" " +
  73.                      "-dismissString \"Cancel\" " );
  74.     } else {
  75.         $gridTypes = "either Dynamic or Static ";
  76.         $buttons = ( "-button \"Set to Dynamic\" " +
  77.                      "-button \"Set to Static\" " +
  78.                      "-button \"Cancel\" " +
  79.                      "-cancelButton \"Cancel\" " +
  80.                      "-defaultButton \"Set to Dynamic\" " +
  81.                      "-dismissString \"Cancel\" " );
  82.     }
  83.     
  84.     string $currentUI = `substitute "and" $current " and "`;
  85.     
  86.  
  87.     if( !`exists getActiveFluidShapes` ) {
  88.         source "getFluidShape.mel";
  89.     }
  90.  
  91.     string $selFluids[] = `getActiveFluidShapes`;
  92.     string $response = eval( "confirmDialog -title " +
  93.                              "\"Cannot paint \'" + $currentUI + 
  94.                              "\' on " + $selFluids[0] + "\"" + 
  95.                              "-message \"In order to paint this " +
  96.                              "attribute, you must first " +
  97.                              "set it to " + $gridTypes + 
  98.                              "Grid.\" " +
  99.                              $buttons );
  100.     
  101.     if( $response == "Set to Dynamic" ) {
  102.         evalEcho( $createDynamic );
  103.     } else if( $response == "Set to Static" ) {
  104.         evalEcho( $createStatic );
  105.     }
  106. }
  107.  
  108.